package cn.mxz.robots.province;

import java.util.Scanner;

import cn.mxz.crawler_single.basic.Request;
import cn.mxz.robots.basic.local.Exam;
import cn.mxz.robots.pojo.Student;

/**
 * 福建省
 * 
 * @author chenmin<chenmin@mouge.wang>
 * @since 2015-06-25
 */
public class Fujian extends Exam
{
	public static void main(String[] args)
	{
		Student student = new Student();
		student.setIdCard("");
		student.setStudentId("350821199704040040 ");
		student.setStudentPwd("tmj19970404");
		student.setAccountNum("15350821151251");
		student.setType("w");
		Fujian guangxi = new Fujian(student);
		System.out.println(guangxi.getCaptcha());
		System.out.println("请输入验证码：");
		@SuppressWarnings("resource")
		String captcha = new Scanner(System.in).next();
		System.out.println(guangxi.login(captcha));
	}

	public Fujian(Student student)
	{
		super(student);
	}

	@Override
	public String getCaptcha()
	{
		Request captchaRequest = new Request("http://220.160.54.46/UEPORTLET/radomImage", mSha1);

		return curlFile(captchaRequest);
	}

	@Override
	public String login(String captcha)
	{
		Request loginRequest = new Request("http://220.160.54.46/UEPORTLET/gkcj.shtml", mSha1);
		loginRequest.addHeader("Referer", "http://220.160.54.46/UEPORTLET/jsp/scores/gkcj/scores_enter.jsp");
		loginRequest.addParams("method", "query");
		loginRequest.addParams("logname", mStudent.getStudentId());
		loginRequest.addParams("pwd", mStudent.getStudentPwd());
		loginRequest.addParams("ksh", mStudent.getAccount());
		loginRequest.addParams("check", captcha);
		String loginHtml = curlPost(loginRequest);

		System.out.println(loginHtml);

		return loginHtml;
	}

	@Override
	public String loginParseHtml(String parseHtml)
	{
		return null;
	}
}
